package com.demo.util;

import java.io.File;

import it.sauronsoftware.jave.AudioAttributes;
import it.sauronsoftware.jave.Encoder;
import it.sauronsoftware.jave.EncodingAttributes;

public class AmrToMp3 {
	public static String armtomp3(String sourceFile, String targetFile)
			throws Exception {
		File source = new File(sourceFile);
		File target = new File(targetFile);

		AudioAttributes audio = new AudioAttributes();
		Encoder encoder = new Encoder();
		for (String ss : encoder.getSupportedEncodingFormats()) {
			System.out.println(ss);
		}
		// pcm_s16le libmp3lame libvorbis libfaac
		audio.setCodec("libmp3lame");
		EncodingAttributes attrs = new EncodingAttributes();
		attrs.setFormat("mp3");
		attrs.setAudioAttributes(audio);

		encoder.encode(source, target, attrs);
		return targetFile;
	}
}
